package com.mt.vsphere.core.util;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.*;
import org.springframework.web.client.RestTemplate;

public class HttpUtil {

    private static RestTemplate restTemplate = new RestTemplate();
    private static Logger logger = LoggerFactory.getLogger("httpUtil");

    public static String sendGet(String url){
        HttpHeaders headers = new HttpHeaders();
        headers.setContentType(MediaType.MULTIPART_FORM_DATA);
        HttpEntity<String> entity = new HttpEntity<>(headers);
        ResponseEntity<String> response =restTemplate.exchange(url, HttpMethod.GET,entity,String.class);
        //
        System.out.println();


        return response.getBody();
    }

//    public static void main(String[] args) {
//        String resp = sendGet("https://api.jinse.com/v6/coin/getList?page=1&limit=20&sortby=market_cap&order=desc&search=&currency=CNY");
//        List<CoinData> list = JsonUtil.getListByJsonString(resp, CoinData.class);
//        Map<String,CoinData> map = new HashMap<>();
//        for (CoinData jinSeData:list){
//            System.out.println(JsonUtil.getJsonString(jinSeData));
//            map.put(jinSeData.getSymbol(),jinSeData);
//        }
//        System.out.println(map);
//    }
    public static String sendPost(){
        return "";
    }

}
